![]() |
PtToAngle |
||||
Header: | Quickdraw.h | Carbon status: | Supported | |
Calculates an angle between a vertical line pointing straight up from the center of a rectangle and a line from the center to a given point.
void PtToAngle ( const Rect *r, Point pt, SInt16 *angle );
The rectangle to examine.
The point to which an angle is to be calculated.
On return, a pointer to the resulting angle.
The result returned in the angle parameter is specified in degrees from 0 to 359, measured clockwise from 12 o’clock, with 90∞ at 3 o’clock, 180∞ at 6 o’clock, and 270∞ at 9 o’clock. Other angles are measured relative to the rectangle. If the line to the given point goes through the upper-right corner of the rectangle, the angle returned is 45∞, even if the rectangle is not square; if it goes through the lower-right corner, the angle is 135∞, and so on.
The angle returned can be used as input to one of the functions that manipulate arcs and wedges, in “Drawing Arcs and Wedges”.
If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)